package sys;
import java.sql.*;

public class BaseConnection
{

    Connection conn=null;// 链接数据库的对象

    public Connection getConnection()
    {   //返回数据库的链接
        String url = "jdbc:mysql://localhost:3306/student";
        try {
            Class.forName("com.mysql.cj.jdbc.Driver");
            DriverManager.registerDriver(new com.mysql.cj.jdbc.Driver());
            conn=DriverManager.getConnection(url,"root","123456");
        } catch (Exception e) {
            e.printStackTrace();
        }
        return conn;
    }

}
